home *** CD-ROM | disk | FTP | other *** search
/ IRIX Installation Tools & Overlays 2002 November / SGI IRIX Installation Tools & Overlays 2002 November - Disc 4.iso / dist / motif21_dev.idb / usr / Motif-2.1 / include / Xm / Sgi.h.z / Sgi.h
C/C++ Source or Header  |  2002-10-15  |  4KB  |  114 lines

  1. #ifndef _Sgi_h
  2. #define _Sgi_h
  3.  
  4. /*****************************************************************************/
  5. /*****************************************************************************/
  6. /**                                                                         **/
  7. /**                          Types for Hash Tables                          **/
  8. /**                                                                         **/
  9. /*****************************************************************************/
  10.  
  11. /* --- POINTER_TO_* is eq hash.  STRING_TO_* is case-insensitive string --- */
  12. /* --- hash.  *_TO_POINTER means it returns void*, *_TO_INTEGER means   --- */
  13. /* --- it returns int.  NULL and 0 represent the empty key so you can't --- */
  14. /* --- hash on them.                                --- */
  15.  
  16. typedef int sgTableSizeType;
  17.  
  18. typedef union _sgKey {
  19.     void *    pointer_key;
  20.     int       integer_key;
  21. } sgKey;
  22.  
  23. typedef struct _sgHashTableEntry {
  24.     sgKey  key;
  25.     union {
  26.     void *    pointer_val;
  27.     int       integer_val;
  28.     } val;
  29. } sgHashTableEntry, *sgHashTableEntryP;
  30.  
  31. typedef struct _sgHashTable {
  32.     sgHashTableEntry     *body;
  33.     sgTableSizeType       size;
  34.     sgTableSizeType       nentries;  /* must be less than size so that */
  35.                                      /* gethash does't loop forever.   */
  36.     sgTableSizeType       max_entries;  /* (size * REHASH_THRESHOLD) */
  37. }  sgHashTable;
  38.  
  39.  
  40. typedef struct _sgHashTable *sgHashTableP;
  41.  
  42.  
  43. /*****************************************************************************/
  44. /*****************************************************************************/
  45. /**                                                                         **/
  46. /**                  Prototypes for Hash Table Routines                     **/
  47. /**                                                                         **/
  48. /*****************************************************************************/
  49.  
  50. #ifndef SKIP_DECLS
  51. #ifdef _NO_PROTO
  52.  
  53. /* --- Public Function Declarations --- */
  54. extern sgHashTableP  _sgMakeHashTable();
  55. extern void         _sgFreeHashTable();
  56. extern void         _sgClearHashTable();
  57. extern void         _sgRemHashp();
  58. extern void         _sgRemHashi();
  59. extern void *        _sgGetHashKeyp();
  60.  
  61. /* --- pointer or string to pointer or string --- */
  62. extern void *      _sgGetHashpp();
  63. extern void       _sgPutHashpp();
  64. extern void       _sgMapHashpp();
  65.  
  66. /* --- pointer or string to int --- */
  67. extern int        _sgGetHashpi();
  68. extern void      _sgPutHashpi();
  69. extern void      _sgMapHashpi();
  70.  
  71. /* --- int to pointer or string --- */
  72. extern void *    _sgGetHaship();
  73. extern void     _sgPutHaship();
  74. extern void     _sgMapHaship();
  75.  
  76. /* --- int to int --- */
  77. extern int        _sgGetHashii();
  78. extern void      _sgPutHashii();
  79. extern void      _sgMapHashii();
  80.  
  81. #else
  82.  
  83. extern  sgHashTableP  _sgMakeHashTable(void);
  84. extern  void          _sgFreeHashTable(sgHashTableP);
  85. extern  void          _sgClearHashTable(sgHashTableP);
  86. extern  void          _sgRemHashp(void *, sgHashTableP);
  87. extern  void          _sgRemHashi(int, sgHashTableP);
  88. extern  void *        _sgGetHashKeyp(void *, sgHashTableP);
  89.  
  90. /* --- pointer or string to pointer or string --- */
  91. extern  void *       _sgGetHashpp(void *, sgHashTableP);
  92. extern  void         _sgPutHashpp(void *, sgHashTableP, void *);
  93. extern  void         _sgMapHashpp(sgHashTableP, void (*)(), int);  
  94.  
  95. /* --- pointer or string to int --- */
  96. extern  int       _sgGetHashpi(void *, sgHashTableP);
  97. extern  void      _sgPutHashpi(void *, sgHashTableP, int);
  98. extern  void      _sgMapHashpi(sgHashTableP, void (*)(), int);
  99.  
  100. /* --- int to pointer or string --- */
  101. extern  void *       _sgGetHaship(int, sgHashTableP);
  102. extern  void         _sgPutHaship(int, sgHashTableP, void *);
  103. extern  void         _sgMapHaship(sgHashTableP, void (*)(), int);
  104.  
  105. /* --- int to int --- */
  106. extern  int       _sgGetHashii(int, sgHashTableP);
  107. extern  void      _sgPutHashii(int, sgHashTableP, int);
  108. extern  void      _sgMapHashii(sgHashTableP, void (*)(), int);
  109. #endif
  110. #endif
  111.  
  112. #endif /* _Sgi_h */
  113. /* DON'T ADD STUFF AFTER THIS #endif */
  114.